package model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Entity of Music
 * This class implements Parcelable, allowing to put this Object in a Bundle
 * @author jean
 *
 */
public class Music implements Parcelable {

	private int id;
	private String fileName;
	private String pathName;
	private String title;
	private String trackNumber;
	private int nbPlay;
	private boolean isLike;
	private int idArtist;
	private int idAlbum;
	private int idPlaylist;
	private int idGenre;
	
	public Music() {
		nbPlay = 0;
		isLike = false;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public String getPathName() {
		return pathName;
	}
	public void setPathName(String pathName) {
		this.pathName = pathName;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public int getNbPlay() {
		return nbPlay;
	}
	public void setNbPlay(int nbPlay) {
		this.nbPlay = nbPlay;
	}
	public boolean isLike() {
		return isLike;
	}
	public void setLike(boolean isLike) {
		this.isLike = isLike;
	}
	public int getIdArtist() {
		return idArtist;
	}
	public void setIdArtist(int idArtist) {
		this.idArtist = idArtist;
	}
	public int getIdAlbum() {
		return idAlbum;
	}
	public void setIdAlbum(int idAlbum) {
		this.idAlbum = idAlbum;
	}
	public int getIdPlaylist() {
		return idPlaylist;
	}
	public void setIdPlaylist(int idPlaylist) {
		this.idPlaylist = idPlaylist;
	}
	public int getIdGenre() {
		return idGenre;
	}
	public void setIdGenre(int idGenre) {
		this.idGenre = idGenre;
	}

	public String getTrackNumber() {
		return trackNumber;
	}

	public void setTrackNumber(String trackNumber) {
		this.trackNumber = trackNumber;
	}

	public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(id);
        out.writeString(fileName);
        out.writeString(pathName);
        out.writeString(title);
        out.writeString(trackNumber);
        out.writeInt(nbPlay);
        out.writeByte((byte) (isLike ? 1 : 0));
        out.writeInt(idArtist);
        out.writeInt(idAlbum);
        out.writeInt(idPlaylist);
        out.writeInt(idGenre);
    }

    public static final Parcelable.Creator<Music> CREATOR
            = new Parcelable.Creator<Music>() {
        public Music createFromParcel(Parcel in) {
            return new Music(in);
        }

        public Music[] newArray(int size) {
            return new Music[size];
        }
    };
    
    private Music(Parcel in) {
    	id = in.readInt();
    	fileName = in.readString();
    	pathName = in.readString();
    	title = in.readString();
    	trackNumber = in.readString();
    	nbPlay = in.readInt();
    	isLike = in.readByte() == 1;
    	idArtist = in.readInt();
    	idAlbum = in.readInt();
    	idGenre = in.readInt();
    	idPlaylist = in.readInt();
    }
	
	
	
	
}
